YAHOO.namespace("draftrack.layout.togglesideBar");

YAHOO.draftrack.layout.togglesideBar = function() {
	var callback ={
		  success:function(o){},
		  failure:function(o){}
	};
	
	var toggle = function() {
		var dt_sidebar = document.getElementById('dt_sidebar');
		var dt_hideSidebar = document.getElementById('dt_hideSideBar');
		var sUrl = document.getElementById('js_dt_toggleSideBarBaseURL').innerHTML;
		if(dt_sidebar.style.display == 'none') {
			dt_sidebar.style.display = 'block';
			dt_hideSidebar.className = '';
			var request = YAHOO.util.Connect.asyncRequest('GET', sUrl+'?mode=visible', callback); 
		} else {
			dt_sidebar.style.display = 'none';		
			dt_hideSidebar.className = 'hidden';
			dt_hideSidebar.style.background = '#EEEEEE';
			setTimeout("document.getElementById('dt_hideSideBar').style.background = 'inherit';", 1000);
			var request = YAHOO.util.Connect.asyncRequest('GET', sUrl+'?mode=hidden', callback);
		}	
	} //end toggle
	
	return { 
		t:toggle
	        }; 
}();

YAHOO.util.Event.addListener('dt_hideSideBar', "click", YAHOO.draftrack.layout.togglesideBar.t);
